:root {
    --cody-chat-code-background: var(--code-background);
    --cody-chat-code-header-background: var(--vscode-editorGroupHeader-tabsBackground);
    --cody-chat-code-subtle-background: var(--vscode-titleBar-inactiveBackground);
    --cody-chat-code-border-color: var(--vscode-widget-border);
    --cody-chat-code-text-muted: var(--vscode-input-placeholderForeground);
    --cody-chat-code-focus-border: var(--vscode-focusBorder);
    --cody-chat-code-mark-background: #f8e688;
    --cody-chat-code-text-highlighted: #566880;
}

.result-container {
    contain: paint;
    :global(.match-highlight) {
        color: var(--cody-chat-code-text-highlighted);
        background-color: var(--cody-chat-code-mark-background) !important;
    }

    :global(.sr-only) {
        position: absolute;
        width: 0.0625rem;
        height: 0.0625rem;
        padding: 0;
        margin: -0.0625rem;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

.header {
    background-color: var(--vscode-editor-background);
    position: sticky;
    top: 0;
    border-bottom: solid 1px var(--cody-chat-code-border-color);

    /* Show on top of search result contents */
    z-index: 1;

    &-title {
        flex: 1 1 auto;
        display: flex;
        flex-wrap: wrap;
    }
}

.result {
    border-bottom: solid 1px var(--cody-chat-code-border-color);
    background-color: var(--vscode-editor-background);

    code {
        padding: 0 !important;
    }
}

.search-result-match {
    /* Don't use cascading link style */
    text-decoration: none;
    display: flex;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
}

.horizontal-divider-between {
    &:not(:last-child) {
        border-bottom: 1px solid var(--cody-chat-code-border-color);
    }
}

.focusable-block {
    &:focus-visible {
        box-shadow: inset 0 0 0 1px var(--cody-chat-code-focus-border);
    }
}

.clickable {
    cursor: pointer;
    &:hover {
        text-decoration: none;
    }
}

.divider-between {
    > *:not(:last-child)::after {
        content: ' ';
        height: 1rem;
        margin: 0 0.75rem;
        border-right: 1px solid var(--cody-chat-code-border-color);
        display: block;
    }
}

.divider-vertical {
    border-bottom: 1px solid var(--cody-chat-code-border-color);
    width: 100%;
    margin: 0.5rem 0;
}

.divider {
    border-right: 1px solid var(--cody-chat-code-border-color);
    height: 1rem;
    margin: 0 0.5rem;
}

.title {
    display: flex;
    align-items: center;
    flex-grow: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.title-inner {
    overflow-wrap: anywhere;
}

.toggle-matches-button {
    width: 100%;
    text-align: left;
    border: none;
    padding: 0.25rem 0.5rem;
    border-top: 1px solid var(--cody-chat-code-border-color);
    color: var(--cody-chat-code-text-muted);
    font-size: theme('fontSize.sm');

    &:hover {
        color: inherit;
    }

    &--expanded {
        position: sticky;
        bottom: 0;
    }

    &-text {
        margin-left: 0.125rem;
    }
}

.addToContextLabel {
    color: var(--cody-chat-code-text-muted);
}
